package manager;

import java.util.List;

import org.hibernate.Query;
import org.hibernate.Session;

import bean.Client;
import bean.Voyage;

public class Base {

	public static List<Voyage> listerVoyages(Session sessionHibernate) {
		Query query = sessionHibernate.createQuery("from " + Voyage.class.getName());
		List<Voyage> res = query.list();
		return res;
	}
	
	public static Client getClient(String login, Session sessionHibernate){
		Query query = sessionHibernate.createQuery("from "+ Client.class.getName()+" where login = '"+login+"'");
		List<Client> res = query.list();
		if(res.size() == 1) return res.get(0);
		else return null;
	}
}
